5. Editing Source Code



This chapter explains how to use the CodeWarrior IDE text editor to edit your source code.

The CodeWarrior editor is a full-featured text editor specially designed for programmers, with features such as:

The topics in this chapter are:

  • Guided Tour of the Editor Window
  • Editor Window Configuration
  • Basic Text Editing
  • Navigating the Text
  • Online References
  • You can also customize options that affect the way the CodeWarrior editor works. To learn more about how to do this, refer to "Editor Settings" on page 269.


    Guided Tour of the Editor Window

    The CodeWarrior editor window, shown in Figure 5.1, contains elements you'll find useful when viewing and editing your source files.

    Figure 5.1 The editor window



    To see an editor window, create a new text file using the New Text File command on the File Menu.

    The sections that follow describe the elements of the editor window shown in Figure 5.1.


    Text Editing Area

    The Text Editing Area of the editor window is where your text is entered and edited.

    You may select and drag text out of an editor window to any destination that can accept a drop, such as another open editor window. You may also drag selected text into an editor window from other applications that support drag-and-drop.

    For more information about drag and drop operations with text, see "Moving Text (Drag and Drop)" on page 150.


    Interface Pop-Up Menu

    Use the Interface pop-up menu shown in Figure 5.2 to open interface or header files referenced by the current file. You can also use the Touch and Untouch commands from this pop-up.

    Figure 5.2 The Interface pop-up menu



    To open a file in the list, scroll down to the file you'd like to see and release the mouse button. Note that in order to see a list of files in the menu, the project file must be opened. Note also that some files cannot be opened, such as precompiled header files and libraries.

    For more information on opening files, see "Opening an Existing File" on page 108.

    To recompile your file the next time the project is built, you choose the Touch command. If you click on the Interface pop-up again you can deselect the file for compilation with the Untouch command in the menu.

    To learn more about touching files, see "Touching and Untouching Files" on page 89.


    Routine Pop-Up Menu

    Use the Routine pop-up menu shown in Figure 5.3 to set the current location of the text insertion point in your text files.

    The Routine pop-up menu lists the routines in your source file. The highlighted or bulleted routine in the pop-up tells you where the text insertion point is currently located.

    Figure 5.3 The Routine pop-up menu




    NOTE

    If the pop-up is empty, the file is not a source file.

    NOTE

    By default, the menu lists the routines in the order in which they appear in the file. If you'd like to list routines alphabetically, hold down Ctrl/Option and click on the routine icon.

    If you'd like to change the default display order of the routines to alphabetical, enable the Sort function popup option. See "Editor Settings" on page 269 for more information about editor options.


    TIP

    If you're editing a Pascal file, the Routine pop-up menu displays function names in italics, procedure names are in plain face, and the main program is in bold.

    Marker Pop-Up Menu

    Use the Marker pop-up menu shown in Figure 5.4 to add and remove markers in your text files. These markers are easy to use and convenient for quick access to a line of text, remembering where you left off, and other identification purposes.

    Figure 5.4 The Marker pop-up menu



    For more information on using markers, see "Adding, Removing, and Selecting a Marker" on page 154.


    Options Pop-Up Menu

    Use the Options pop-up menu, shown in Figure 5.5, to turn color syntax highlighting on or off for the current file, and also to set the format for how to save the file.

    To enable or disable syntax highlighting, choose Syntax Coloring from the Options pop-up menu.

    The type of file currently open in the editor window is indicated by a check mark next to the Macintosh, DOS, or UNIX options in the pop-up menu. The next time you save the file, the CodeWarrior IDE saves it in the format you select.

    For more information on the Syntax Coloring option shown in this menu, see "Syntax Coloring" on page 274.

    Figure 5.5 The Options pop-up menu




    VCS Pop-Up Menu

    The VCS pop-up menu indicates the read/write revision control database status of the current file. If the pop-up icon box shows an Unlocked icon or the Read/Write icon, you can modify the file you're working with. The icons and their meanings are described in the section called "Common VCS Operations" on page 593.

    Using this pop-up menu, you can get a new copy of your file, checkout the file for modification, make it writable so you can make changes without doing a checkout, and other operations.

    For more information about revision control system software, see "Common VCS Operations" on page 593.


    File Path Caption

    The CodeWarrior IDE automatically displays the directory path of the current file in the File Path Caption, which is at the top right of the window shown in Figure 5.1 on page 134.


    Mac OS

    To learn about another method of determining the path of a file, refer to "Path Pop-Up Menu (Mac OS)" on page 141.


    Dirty File Marker

    The Dirty File Marker tells you if the file displayed in a window has been modified since it was last saved or opened. The states of the Dirty File Marker are listed in Table 5.1.

    Table 5.1 Dirty File Marker states

    State
    Description
    Unchanged file
    Modified and unsaved file ("dirty")


    Pane Splitter Controls

    Pane Splitter Controls split the editor windows into panes so you can view different portions of a file in the same window.

    You use these controls to adjust the sizes of the panes after you've created them. Figure 5.8 on page 143 shows an editor window with multiple panes.

    For more information on this topic, see "Splitting the Window into Panes" on page 143.


    Line Number Button

    The line number box shown in Figure 5.1 displays the number of the line that contains the text insertion point. You can also use this button to go to another line in the file.

    For information about setting the text insertion point on another line, see "Going to a Particular Line" on page 157.


    Toolbar Disclosure Button

    The Toolbar Disclosure Button hides or displays the editor window's toolbar along the top of the window. If the toolbar is hidden, a row of smaller controls appears at the bottom of the editor window (see Figure 5.7 on page 142).

    For more information on using the Toolbar Disclosure Button, refer to"Seeing Window Controls" on page 142.


    Path Pop-Up Menu (Mac OS)

    To see the directory path of the file in the active editor window, press the Command key and click on the name of the file in the title bar of the window, as shown in Figure 5.6. You can also directly open a folder by choosing it from the menu.

    Figure 5.6 File Path pop-up in the window titlebar



    Editor Window Configuration

    The editor allows you to customize your view of the file you're working with. In this section, you'll learn about the following topics:

    To learn about configuring the editor window's toolbar, see "Customizing the IDE" on page 289.


    Setting Text Size and Font

    You use the Font & Tabs preference panel to set the size or font used to display text in an editor window. For more information on this topic, see "Font & Tabs" on page 273.


    Seeing Window Controls

    The row of pop-up menus and controls that appears along the top of the editor window is called the toolbar. The Toolbar Disclosure Button, shown in Figure 5.1 on page 134, is used to show or hide the toolbar.

    However, if you hide the toolbar, the default pop-up menu controls are displayed along the bottom of the editor window, as shown in Figure 5.7. Note that the File Path Caption is no longer visible.


    NOTE

    If you hide a customized editor window toolbar, custom items do not appear at the bottom of the window. The default items always appear when the toolbar is hidden. When you show the toolbar again, it retains its custom configuration. For information on toolbars in general, and customizing them, see "Customizing the IDE" on page 289.

    Figure 5.7 Pop-ups along the editor window bottom



    To show the toolbar along the top of the editor window again, click the Toolbar Disclosure Button once more.

    You can choose a default setting to display or hide the toolbar in editor windows. To do so, see "Toolbar Disclosure Button" on page 140 for more information. See also "Showing and hiding a toolbar" on page 308.


    Splitting the Window into Panes

    You can split the editor window into panes to view different parts of a file in the same window, as shown in Figure 5.8. This section describes creating, adjusting, and removing multiple panes.

    Figure 5.8 Multiple panes in a window




    Creating a new pane

    To create a new pane in an editor window, click and drag a Splitter Bar. Splitter bars are on each scroll bar of a pane in the editor window, on the top and left sides.

    As you drag a Splitter Bar, a gray focus line tracks your progress and indicates where the new pane will go. When you release the mouse button, the editor creates a new pane.

    You can also double-click the Splitter Bar to split a pane into two equal parts.


    Resizing a pane

    To change the sizes of the panes in an editor window, click and drag the pane resize boxes.

    As you drag a resize box, a gray focus line indicates your progress. When you release the mouse button, the editor redraws the panes in their new positions.


    Removing a pane

    To remove a pane from an editor window, click and drag a Resize Box all the way to an edge of the window.

    As you drag the Resize Box, a gray focus line indicates your progress. If you drag close to the edge of the window, the gray lines are no longer displayed. If you release the mouse button at that time, the editor removes one of the panes from the window.

    You can also double-click on a Resize Box to remove a split.


    Saving Editor Window Settings

    The current settings of an editor window are automatically saved whenever the window is closed, or when the toolbar is hidden or displayed.

    The settings saved include the size and location of the window, and the display of the toolbar. When you reopen the same editor window at a later time, it uses the saved settings.


    WARNING!

    (Mac OS) If you are using a revision control system for your source code files that uses native file locking, you must have your file checked out in order for the settings to be saved. If you are using ckid resources to lock the files, the information is saved for you without checking out the file.

    To learn more about configuring editor window settings, refer to "Font & Tabs" on page 273.

    To learn about saving default settings for browser windows, see "Saving a Default Browser" on page 247.


    Basic Text Editing

    The CodeWarrior IDE gives you lots of help in editing source files, all of it described in the topics that follow.

    The topics in this section are:


    Basic Editor Window Navigation

    The CodeWarrior IDE gives you several ways to move the text insertion point in a file. Review this section again after you become more familiar with the CodeWarrior editor's features.


    Scrollbar navigation

    Like any other text editor, you may adjust the text to view in an editor window by using the scroll bars.

    The CodeWarrior IDE lets you configure how the scroll bars affect the window view when you drag the scroll bar thumb around. You can modify the way that scrolling behaves in the editor windows of your project by changing the Dynamic scrolling option. To learn how to do this, refer to "Dynamic scrolling" on page 271.


    Keyboard navigation

    Table 5.2 describes how to move the insertion point around in a file with function keys.

    For information on Solaris modifier key settings, see "Special note for Solaris users" on page 23.

    Table 5.2 Text navigation with the keyboard

    To move insertion point to

    Windows

    Mac OS

    Solaris
    Previous word
    Control-
    Left Arrow
    Option-
    Left Arrow
    Alt-
    Left Arrow
    Next word
    Control-
    Right Arrow
    Option-
    Right Arrow
    Alt-
    Right Arrow
    Beginning of line
    Home
    Command-
    Left Arrow
    Meta-
    Left Arrow
    End of line
    End
    Command-
    Right Arrow
    Meta-
    Right Arrow
    Beginning of file
    Control-Home
    Option-
    Up Arrow
    Alt-Up Arrow
    End of file
    Control-End
    Option-
    Down Arrow
    Alt-
    Down Arrow

    Table 5.3 describes how to scroll to different locations in a file, without moving the insertion point. Note that some of the keys listed in the table may not be on your keyboard, depending on what kind of keyboard you have.

    For information on Solaris modifier key settings, see "Special note for Solaris users" on page 23.

    Table 5.3 Scroll with the keyboard

    To move insertion point to

    Windows

    Mac OS

    Solaris
    Previous page
    Page Up
    Page Up
    Page Up
    Next page
    Page Down
    Page Down
    Page Down
    Beginning of file
    Control-Home
    Home
    Home
    End of file
    Control-End
    End
    End
    Previous line
    Control-
    Up Arrow
    Control-
    Up Arrow
    Control-
    Up Arrow
    Next line
    Control-
    Down Arrow
    Control-
    Down Arrow
    Control-
    Down Arrow


    Adding Text

    To add text to a file you've opened, click once in the Text Editing Area of the window to set the new location of the text insertion point. After you see the insertion point at the new location, you may begin typing on the keyboard to enter text.

    To read about different ways to move the insertion point in an editor window, see "Basic Editor Window Navigation" on page 145.


    Deleting Text

    There are several different methods for deleting text.

    To delete text that you just typed, press the Backspace/Delete key.

    To delete text that is in front of the text insertion point, use the Delete/Del () key.

    To delete more than one contiguous character at a time, select the text you want to delete and press the Backspace/Delete keyboard shortcut.


    Mac OS

    To delete text from the text insertion point to the end of the file, use the Control/Command Delete keyboard shortcut.

    If you don't know how to select text, read "Selecting Text" in the next section.


    Selecting Text

    There are several different ways to select text in the editor window.

    Select text by holding down the Shift key while pressing any of the shortcuts listed in Table 5.2. You may also select a word, a line, or a range of text.

    To select a word:

    To select a line:

  • triple-click anywhere in the line
  • move the mouse pointer to the left edge of the editor window so that the mouse pointer points right and press the mouse button
  • This selection method is available when the Left margin click selects line option is on in the Editor Settings preference panel.

    To select a range of text:

  • click and drag the mouse in a portion of your window where there is text
  • set your text insertion point to mark the beginning of your selection then press the Shift key while clicking the place in your text where you want the selection to end
  • move the mouse pointer to the left edge of the editor window so that the mouse pointer points right, then click and drag the mouse pointer to select lines of text
  • This selection method is available when the Left margin click selects line option is on in the Editor Settings preference panel.


    Mac OS and Solaris

    The editor can select parts of text identifiers by holding down the Control key while using the left or right arrow keys, or when double-clicking. For example, double-clicking between the two "m" characters in FindCommandStatus() would result in the word Command being selected.

    To display and highlight an entire routine in the editor window, press the Shift key while selecting a routine in the Routine Pop-Up Menu. This is particularly useful for copy and paste operations and for using drag and drop to move code around in your file.

    Table 5.4 describes how to select text using the keyboard, starting at the current insertion point. Note that some of the keys listed in the table may not be on your keyboard, depending on what kind of keyboard you have.

    For information on Solaris modifier key settings, see "Special note for Solaris users" on page 23.

    Table 5.4 Text selection with the keyboard

    To select text to the
    Windows
    Mac OS
    Solaris
    Previous word
    Shift-Control-
    Left Arrow
    Shift-Option-
    Left Arrow
    Shift-Option-
    Left Arrow
    Next word
    Shift-Control-
    Right Arrow
    Shift-Option-
    Right Arrow
    Shift-Option-
    Right Arrow
    Beginning of line
    Shift-Home
    Shift-Command-
    Left Arrow
    Shift-Command-
    Left Arrow
    End of line
    Shift-End
    Shift-Command-
    Right Arrow
    Shift-Command-
    Right Arrow
    Beginning of page
    Shift-Page Up
    Shift-Option-
    Up Arrow
    Shift-Option-
    Up Arrow
    End of page
    Shift-Page Down
    Shift-Option-
    Down Arrow
    Shift-Alt-
    Down Arrow
    Beginning of file
    Shift-Control-
    Home
    Shift-Command-
    Up Arrow
    Shift-Meta-
    Up Arrow
    End of file
    Shift-Control-
    End
    Shift-Command-
    Down Arrow
    Shift-Meta-
    Down Arrow

    For more information about using drag and drop with text, see "Moving Text (Drag and Drop)" in the next section.

    You can also select blocks of code quickly using the Balance command. To learn how to do this, refer to "Balancing Punctuation" on page 150.


    Moving Text (Drag and Drop)

    If you have some text in your editor window that you would like to move to a new location, you can use the drag and drop features of the editor to do it. In order to use drag-and-drop editing, this feature must be enabled in the IDE. To learn more about turning this feature on or off, refer to "Editor Settings" on page 269.

    The CodeWarrior editor can also accept drag-and-drop text items from other applications that support drag and drop. To see if one of your applications supports drag and drop, refer to the documentation that came with it.


    TIP

    (Mac OS) If you press the Option key and drag selected text, the text will be copied to your new location instead of moved.

    Using Cut, Copy, Paste, and Clear

    There are standard menu commands available on most computer applications, called Cut, Copy, Paste, and Clear. In the CodeWarrior IDE, these commands appear on the Edit Menu.

    Use these commands to remove text, or to copy and paste in a window, between windows, or between applications.

    For more information about these commands, refer to "Edit Menu" on page 603.


    Balancing Punctuation

    When you're editing source code, you often have to make sure that every parenthesis (()), bracket ([]), and brace ({}) has a mate, or the compiler could misinterpret your code or give you an error.

    The CodeWarrior IDE provides several checks that help you balance these elements correctly.

    To check for balanced parentheses, brackets, or braces, place the insertion point in the text you want to check. Then, choose Balance from the Edit Menu. Alternatively, double-click on a parenthesis, bracket, or brace character that you want to check for a matching character.

    The CodeWarrior editor searches starting from the text insertion point until it finds a parenthesis, bracket, or brace, then it searches in the opposite direction until it finds the matching half. When it finds the match, it selects the text between them. If the insertion point isn't enclosed or if the punctuation is unbalanced, the computer beeps.


    TIP

    Use the Balance command to select blocks of code quickly.

    Using automatic balancing

    You can have the editor check for balanced punctuation automatically. If you would like to learn more about checking the balance of code automatically as you type, refer to "Balance while typing" on page 271.


    Shifting Text Left and Right

    Use the Shift Left and Shift Right commands on the Edit Menu to shift a block of text to the left or right.

    To shift blocks of text, select a block of text. If you don't know how to do this, refer to "Selecting Text" on page 148. After selecting, choose Shift Right or Shift Left from the Edit Menu.

    The CodeWarrior editor shifts the selected text one tab stop to the right or left by inserting or deleting a tab at the beginning of every line in the selection.

    To learn more about controlling the number of spaces the text is indented, refer to "Font & Tabs" on page 273.


    Undoing Changes

    The CodeWarrior editor supplies ways to Undo mistakes as you edit a file.


    Undoing the last edit

    The Undo command reverses the effect of your last action. The name of the Undo command on the Edit Menu varies depending on your last action. For example, if you just typed in some text, the command changes to Undo Typing. Choose Undo Typing to remove the text you just typed.


    Undoing and redoing multiple edits

    When the Use multiple undo option is on, you can Undo, Redo, Multiple Undo, and Multiple Redo previous actions by continuing to choose the Undo or Redo commands.

    For instance, if you Cut a word, then Paste it, then type some text, you can backtrack all those actions by choosing Undo three times. The first Undo removes the text you typed, the second Undo unpastes the text you pasted, and the third Undo uncuts the text you Cut, therefore returning the text to its original condition.

    You can perform those activities again in the same order by choosing the Redo command three times.

    To enable the Use multiple undo option, refer to "Use multiple undo" on page 272.

    Note that the keyboard shortcut for the Redo command changes when the Use multiple undo option is turned off.


    WARNING!

    Undo actions are saved in a stack, therefore it's possible to lose actions when performing several undo and redo actions. Each undo action adds an item to the stack, while each redo repositions a pointer to the next undo action. For example, if there were five undo actions on the stack (ABCDE), and you redo two of them, the stack appears to the pointer like this: ABC. When you perform a new action (ABCF), the undo events (DE) are no longer available.

    Reverting to the last saved version of a file

    The Revert command on the File Menu returns a file to its last saved version. To learn more about how to revert to the previous version of a file, see "Reverting to a Previously-Saved File" on page 125.


    Controlling Color

    You can use color to highlight many elements in your source code, such as comments, keywords, and quoted character strings. Highlighting these elements helps you identify them in the text, so you can check your spelling and syntax as you type by recognizing color patterns. For information on configuring color syntax options, see "Syntax Coloring" on page 274.

    You can also highlight custom keywords, which are in a list of words you designate. See "Syntax Coloring" on page 274 for instructions on configuring the editor to do this for you.


    Navigating the Text

    The CodeWarrior editor provides several methods for navigating a file that you are editing.

    This section covers these methods:

    In addition, the integrated code browser has many powerful techniques for navigating through your code. To learn more about using the CodeWarrior Browser, refer to "Browsing Source Code" on page 205.

    You can change the key bindings that cause the text insertion point to move around in a file. Refer to "Editor Commands" on page 651 for more information.


    Finding a Routine

    Click the Routine icon to display the Routine pop-up menu, discussed in "Routine Pop-Up Menu" on page 136, then select the routine you want to access.


    NOTE

    If the pop-up is empty, the file is not a source code file.

    Adding, Removing, and Selecting a Marker

    You can add or remove a marker in any of your text files using the facilities built into the CodeWarrior editor. Markers are like bookmarks. They are useful for setting places in your file that you can jump to quickly, or for leaving notes to yourself about work in progress on your code.


    Adding a marker

    To add a marker, move the text insertion point to the location in the text you want to mark, then choose Add marker from the Marker Pop-Up Menu. A dialog box named Add Marker appears, shown in Figure 5.9.

    Figure 5.9 Add Marker dialog box



    Enter text in the Add Marker dialog box to mark your insertion point location in the file with a note, comment, routine name, or other text that would be helpful to you.

    When you are through adding your text note, click Add and your marker will be visible in the Marker Pop-Up Menu, as shown in Figure 5.10.


    TIP

    If you select some text in a source file, then choose Add Marker, the selected text will appear as the new marker name in the Add Marker dialog. This is handy for quickly adding specific routines or lines as markers.

    Figure 5.10 Example text File with a marker added




    Adding Markers with #pragma

    There is another method for marking files on a more permanent basis. For C/C++ language programs, use


      #pragma mark myMarker

    to leave markers in a file. For Pascal, use


      {$PRAGMAC MARK myMarker}

    Unlike the markers we've been talking about in this section, these markers don't appear in the Marker Pop-up Menu. Instead, markers created with #pragma mark appear in the Routine Pop-up menu.

    When embedded in your file, this example adds myMarker to the Routine Pop-Up Menu automatically when the file is opened in the editor.


    Removing a marker

    To remove a marker, click the Marker Pop-Up Menu and choose the Remove markers command. The dialog box shown in Figure 5.11 is shown, and you may select the marker you wish to delete. After you select the marker, click Remove to remove it permanently from the marker list. When finished, click Done to close the Remove Markers dialog box.

    Figure 5.11 Remove Markers dialog box




    Jumping to a marker

    Click the Marker Pop-Up Menu and choose the name of the marker from the list shown on the pop-up to set the text insertion point at the location of the marker.


    Opening a Related File

    There are a few ways to open files related to the active editor window. For example, if you are looking at a C++ .cpp source code file and want to view a .h header file that is used by the .cpp file, there are different ways to do this.

    Use the Interface Pop-Up Menu shown in Figure 5.2 on page 136 to open interface or header files referenced by the current file. You can also use the Touch and Untouch commands from this pop-up.

    To open a file in the list, choose the corresponding item from the menu.

    There is another method for opening an interface or header file that your source code file uses. To open the related file, type Control-D (Windows) or Command-D (Mac OS and Solaris) after selecting the file name in the active window. To learn more about this method for opening files, refer to "Opening an Existing File" on page 108.


    Going to a Particular Line

    You can go to a specific line in an editor window if you know its number. Lines are numbered consecutively, with the first line designated as line 1.

    Click the Line Number Button on the editor window to open the Line Number dialog box shown in Figure 5.12. Then enter the number of the line you want to go to and select OK.

    Figure 5.12 Line Number dialog box










    Using Go Back and Go Forward

    The Go Back and Go Forward commands are only available when you use the Browser. If you already have the Browser enabled, refer to "Go Back and Go Forward" on page 242 for information about how to use these commands.

    If you aren't using the Browser and want to learn how to use it, see "Browsing Source Code" on page 205.


    Configuring Editor Commands

    The CodeWarrior IDE allows you to customize key bindings for the editor to suit your working style. Refer to "Editor Commands" on page 651 to learn about the commands you can customize to your liking.


    Opening a File's Directory (Mac OS)

    If you want to know the full directory path for an editor window file, the Path Pop-Up Menu will show it to you. Press the Command key and click on the file name in the window's title bar to view the Path Pop-up Menu.

    You can open the directory that contains the file on display in the active editor window. Just click the Path Pop-Up Menu (Mac OS) and choose any directory you want to open from the pop-up, as shown in Figure 5.6 on page 141.


    Online References

    As you're working on a program, you often need to look up the documentation or definition of a particular routine, variable, or type. You may also need to look up documentation about using the IDE. CodeWarrior has both kinds of documentation readily available.

    Before you can use the online help available from the CodeWarrior IDE, you need to install the help files and viewer applications from the CodeWarrior Reference CD:


    Windows

    Insert the CodeWarrior Reference CD into your CD-ROM drive and wait for a dialog box to appear. Click "Launch CodeWarrior Setup" and follow the onscreen instructions.


    Mac OS

    Insert the CodeWarrior Reference CD into your CD-ROM drive. Double-click the CodeWarrior Reference Installer icon at the root level of the CD. Follow the onscreen instructions to install the help files and viewer applications.

    This section describes how to get started looking up documentation online and how to set up the online reference databases.

    The topics in this section are:


    Finding Symbol Definitions

    This method lets you find the definition of a symbol in your project source files. If the symbol isn't defined in your project, CodeWarrior finds the symbol's definition in the online documentation viewer selected in IDE Extras preferences panel. Supported online reference viewers include WinHelp (Windows), QuickHelp (Mac OS), QuickView (Mac OS), or THINK Reference (Mac OS).

    To look up the definition of a symbol, first select the symbol name in your source code. Then, choose Find Definition from the Search Menu. If you don't want to use the Search menu you can instead Alt/Command double-click on the symbol's name. CodeWarrior searches all the files in your project for the definition of the symbol.

    If CodeWarrior finds one or more matches in your project, it opens a window and displays each of the matches for you to examine. If the Browser is enabled, the window shown will be a browser Symbol window (see "Symbol Window" on page 224). Otherwise, the window will be a Message window (see "Using the Message Window" on page 376).


    Mac OS and Solaris

    You can also use the Find Reference and Find Definition & Reference commands to look up symbol definitions. When you choose the Find Reference (Mac OS) command, CodeWarrior searches the on-line documentation selected in IDE Extras preferences panel (see "IDE Extras" on page 254) for the definition of the selected symbol. If a match is found in the on-line documentation, a viewer is launched and the information displayed. With the Find Definition & Reference (Mac OS) command, CodeWarrior searches the source code files as well as the on-line reference for the definition of the symbol.


    TIP

    To return to your original location after viewing a symbol's definition, press Shift-Ctrl-B (Windows) or Shift-Command-' (Mac OS).

    TIP

    (Mac OS and Solaris) Option double-click or hold down the Option key and choose Find Definition to search only your project's files. This prevents CodeWarrior from searching external reference applications for the definition of the symbol.

    WinHelp (Windows)

    The CodeWarrior IDE provides help files for use with the WinHelp viewer application. WinHelp is part of the Windows operating system.

    You can use WinHelp to look up documentation on Win32, MFC, the ANSI libraries, and the CodeWarrior IDE. In addition, you can right-click on many components in the IDE to view pop-up help information.

    To use WinHelp, choose CodeWarrior IDE from the Help menu. The help file for the IDE is displayed.

    To learn about the IDE, simply click the hypertext links in the WinHelp documentation. For information about performing tasks, click the How to button in the WinHelp window. Clicking the Glossary button provides descriptions of the terms used in the documentation.

    Refer to "Finding Symbol Definitions" on page 159 to begin looking up documentation online.


    QuickHelp (Mac OS)

    QuickHelp comes with the CodeWarrior IDE. The CodeWarrior Help folder contains the help files that are used with QuickHelp.

    You can use QuickHelp to look up documentation on PowerPlant, the ANSI libraries, and the CodeWarrior IDE. In addition, you can use Balloon Help on many components in the IDE to view help information.

    To use QuickHelp, choose CodeWarrior IDE from the Help menu. The help file for the IDE is displayed.

    To learn about the IDE, simply click the hypertext links in the QuickHelp documentation. For information about performing tasks, click the How to button in the QuickHelp window. Clicking the Glossary button provides descriptions of the terms used in the documentation.

    Refer to "Finding Symbol Definitions" on page 159 to begin looking up documentation online.


    QuickView (Mac OS)

    QuickView is part of the Macintosh Programmer's Toolbox Assistant (MPTA) published by Addison-Wesley for Apple Computer.

    You can use QuickView to look up documentation on PowerPlant, the ANSI libraries, and the CodeWarrior IDE.

    If you have the Macintosh Programmer's Toolbox Assistant, you can also look up documentation on Mac OS Toolbox routines.

    To use QuickView with the CodeWarrior IDE, it is necessary to first set up all the QuickView files properly:

    1. Position your files.

    Place all your QuickView files in the same folder as the QuickView application that comes with the CodeWarrior IDE. If you already have the Macintosh Programmer's Toolbox Assistant (MPTA), copy all its QuickView files into the same folder that your CodeWarrior QuickView files are in.

    2. Remove multiple copies of the QuickView application.

    Keep the QuickView application that came with the CodeWarrior IDE. Delete all other QuickView applications on your computer system.

    3. Select QuickView as the on-line reference.

    Refer to "IDE Extras" on page 254 to learn how to select the QuickView application as the online reference database for your project.

    Refer to "Inserting Routine (Reference) Templates (Mac OS)" on page 162 or "Finding Symbol Definitions" on page 159 to begin looking up documentation online.


    THINK Reference (Mac OS)

    To use THINK Reference with the CodeWarrior IDE, refer to "IDE Extras" on page 254 to enable the THINK Reference application as the online reference database for your project.

    You must have the THINK Reference database product properly installed on your computer system. THINK Reference is not part of the CodeWarrior product. THINK Reference is available from Developer Depot on the MacTech CD-ROM and includes several databases on Mac OS Toolbox routines.

    Refer to "Inserting Routine (Reference) Templates (Mac OS)" on page 162 or "Finding Symbol Definitions" on page 159 to begin looking up documentation online.


    Inserting Routine (Reference) Templates (Mac OS)

    If you're looking up a routine (such as an operating system call) in the online reference database, you can paste the template for the call into your editor window at the text insertion point. This is useful when you know the name of the call you want to add to your source code, but you don't know what its parameters are supposed to be.

    A routine template looks like this:


      SetRect(r, left, top, right, bottom);   

    To insert a reference template into your code, type the routine name that you want to insert, then select the name you just typed. Finally, choose Insert Reference Template (Mac OS) from the Edit Menu.

    The CodeWarrior IDE searches for the routine in either QuickView (Mac OS) or THINK Reference (Mac OS), starting the required application if it isn't already running. If the routine is found, the template is copied into your editor window and replaces the text you selected with the template. If the definition is not found, you will hear a beep.


    HyperHelp (Solaris)

    HyperHelp support will be available in future versions of the CodeWarrior IDE for Solaris.





    Visit the Metrowerks website at: http://www.metrowerks.com
    For assistance contact Metrowerks Technical Support at: support@metrowerks.com
    Copyright © 1999, Metrowerks Corp. All rights reserved.

    Last updated: May 24, 1999 * Chris Magnuson * John Roseborough